//
//  CZNavigaitonViewController.m
//  CZOC微博01
//
//  Created by 1 on 15/11/27.
//  Copyright © 2015年 itcast. All rights reserved.
//

#import "CZNavigaitonViewController.h"
#import  "CZNavBarItem.h"

@interface CZNavigaitonViewController ()

@end

@implementation CZNavigaitonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
//实现代理的方法
 
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
+ (void)initialize
{
//    UIBarButtonItem
//     UINavigationItem
    UIBarButtonItem *item=[UIBarButtonItem appearance];
    
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    
    dic[NSForegroundColorAttributeName]=[UIColor orangeColor];
    dic[NSFontAttributeName]=[UIFont systemFontOfSize:13];
    [item setTitleTextAttributes:dic forState:UIControlStateNormal];
    
     //设置按钮的不可点的样式
    
    NSMutableDictionary *dict=[NSMutableDictionary dictionary];
    dict[NSFontAttributeName]=[UIFont systemFontOfSize:13];
    dict[NSForegroundColorAttributeName]=[UIColor lightGrayColor];
    [item setTitleTextAttributes:dict forState:UIControlStateDisabled];
    
    
//    NSLog(@"机会哦啊哦");

}



 - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
  
     if(self.viewControllers.count>0)
     {
         
         viewController.hidesBottomBarWhenPushed=YES;
//    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
//    [btn addTarget:self action:@selector(backBtn) forControlEvents:UIControlEventTouchUpInside];
//    [btn setBackgroundImage:[UIImage imageNamed:@"navigationbar_pop"] forState:UIControlStateNormal];
//    [btn setBackgroundImage:[UIImage imageNamed:@"navigationbar_pop_highlighted"] forState:UIControlStateHighlighted];
//    
//    btn.size=btn.currentBackgroundImage.size;
//    viewController.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:btn];
    
//    UIButton *btn1=[UIButton buttonWithType:UIButtonTypeContactAdd];
    
//    [btn1 addTarget:self action:@selector(backMore) forControlEvents:UIControlEventTouchUpInside];
    viewController.navigationItem.rightBarButtonItem=[CZNavBarItem itemWithTarget:self action:@selector(backMore) image:@"navigationbar_pop" hightImage:nil];
         viewController.navigationItem.leftBarButtonItem=[CZNavBarItem itemWithTarget:self action:@selector(backBtn) image:@"navigationbar_pop" hightImage:nil];
      
  
     }
    [super pushViewController:viewController animated:YES];
}
- (void)backBtn
{
    [self popViewControllerAnimated:YES];
}
- (void)backMore
{
    [self popToRootViewControllerAnimated:YES];
}


@end
